import type { ModelInfo } from "../model.js"

// https://docs.x.ai/docs/api-reference
export type XAIModelId = keyof typeof xaiModels

export const xaiDefaultModelId: XAIModelId = "grok-code-fast-1"

export const xaiModels = {
	"grok-code-fast-1": {
		maxTokens: 16_384,
		contextWindow: 256_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.2,
		outputPrice: 1.5,
		cacheWritesPrice: 0.02,
		cacheReadsPrice: 0.02,
		description: "xAI's Grok Code Fast model with 256K context window",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-4-1-fast-reasoning": {
		maxTokens: 65_536,
		contextWindow: 2_000_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.2,
		outputPrice: 0.5,
		cacheWritesPrice: 0.05,
		cacheReadsPrice: 0.05,
		description:
			"xAI's Grok 4.1 Fast model with 2M context window, optimized for high-performance agentic tool calling with reasoning",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-4-1-fast-non-reasoning": {
		maxTokens: 65_536,
		contextWindow: 2_000_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.2,
		outputPrice: 0.5,
		cacheWritesPrice: 0.05,
		cacheReadsPrice: 0.05,
		description:
			"xAI's Grok 4.1 Fast model with 2M context window, optimized for high-performance agentic tool calling",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-4-fast-reasoning": {
		maxTokens: 65_536,
		contextWindow: 2_000_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.2,
		outputPrice: 0.5,
		cacheWritesPrice: 0.05,
		cacheReadsPrice: 0.05,
		description:
			"xAI's Grok 4 Fast model with 2M context window, optimized for high-performance agentic tool calling with reasoning",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-4-fast-non-reasoning": {
		maxTokens: 65_536,
		contextWindow: 2_000_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.2,
		outputPrice: 0.5,
		cacheWritesPrice: 0.05,
		cacheReadsPrice: 0.05,
		description:
			"xAI's Grok 4 Fast model with 2M context window, optimized for high-performance agentic tool calling",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-4-0709": {
		maxTokens: 8192,
		contextWindow: 256_000,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 3.0,
		outputPrice: 15.0,
		cacheWritesPrice: 0.75,
		cacheReadsPrice: 0.75,
		description: "xAI's Grok-4 model with 256K context window",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-3-mini": {
		maxTokens: 8192,
		contextWindow: 131072,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 0.3,
		outputPrice: 0.5,
		cacheWritesPrice: 0.07,
		cacheReadsPrice: 0.07,
		description: "xAI's Grok-3 mini model with 128K context window",
		supportsReasoningEffort: ["low", "high"],
		reasoningEffort: "low",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
	"grok-3": {
		maxTokens: 8192,
		contextWindow: 131072,
		supportsImages: true,
		supportsPromptCache: true,
		supportsNativeTools: true,
		inputPrice: 3.0,
		outputPrice: 15.0,
		cacheWritesPrice: 0.75,
		cacheReadsPrice: 0.75,
		description: "xAI's Grok-3 model with 128K context window",
		includedTools: ["search_replace"],
		excludedTools: ["apply_diff"],
	},
} as const satisfies Record<string, ModelInfo>
